﻿@model PortalWeb.Core.Entity.RoleGroup
@{
    Layout = "~/Areas/Admin/Views/Shared/_AdminLayout.cshtml";
    ViewBag.Title = "Index";
}
<div class="header">
    <h1>@ViewBag.Title</h1>
</div>
<ul class="breadcrumb">
    <li>@Html.ActionLink("首页", "Index", "Home")</li>
    <li>@Html.ActionLink("用户管理", "Index")</li>
</ul>
<div class="container-fluid">
    <div class="row-fluid">

        <div class="well">
            <div class="btn-toolbar" id="toolbar">

            </div>
            <div class="row">
                <div class="col-md-4">
                    <div class="panel panel-primary">
                        <div class="panel-heading">Panel heading without title</div>
                        <div class="panel-body">
                            <div id="RoleTree"></div>
                        </div>
                    </div>
                </div>
                <div class="col-md-4">
                    <div class="panel panel-primary">
                        <div class="panel-heading">Panel heading without title</div>
                        <div class="panel-body">
                            <div id="FunctionTree"></div>
                        </div>
                    </div>
                </div>
                <div class="col-md-4">
                    <div class="panel panel-primary">
                        <div class="panel-heading">Panel heading without title</div>
                        <div class="panel-body">

                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

            @section scripts{
                <script>
                    $.ajax({
                        type: "POST",
                        url: "@Url.Action("RoleTree")",
                        dateType: "json",
                        data: {},
                        contentType: "application/x-www-form-urlencoded; charset=utf-8",
                        success: function (data) {
                            $('#RoleTree').treeview({ data: data });
                        }
                    });

                    $.ajax({
                        type: "POST",
                        url: "@Url.Action("FunctionTree")",
                        dateType: "json",
                        data: {},
                        contentType: "application/x-www-form-urlencoded; charset=utf-8",
                        success: function (response) {
                            if (response.status)
                                $('#FunctionTree').treeview({
                                    data: response.data,
                                    levels: 5,
                             
                                    showTags: true,
                                    showIcon: true,
                                    showCheckbox: true,
                                    onNodeChecked: function (event, data) {
                                        // Your logic goes here
                                        alert(data.id);
                                    },
                                    onNodeUnchecked: function (event, data) {
                                        // Your logic goes here
                                        alert(data);

                                    }
                                })
                        }
                    });
                </script>
 }


